<?php include  APP_PATH.'../template/public/header.php'?>
<aside class="main-sidebar">
    <section class="sidebar">
        <?php include APP_PATH.'../template/public/navigation.php'?>
    </section>
</aside>
<div class="content-wrapper">
    <section class="content-header">
        <h1>
            {$title}
            <a href="{:url('add_child_users')}" class="btn  btn-primary ">新建子账户</a>
        </h1>

        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i>{$title}</a></li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-body">
                        <table id='table'
                               data-url=""
                               data-toggle="table"
                               data-show-refresh="true"
                               data-show-toggle="true"
                               data-show-columns="true"
                               data-search="true"
                               data-ajax="ajax_request"
                               data-advanced-search="true"
                               data-pagination="true"
                               data-side-pagination="server"
                               data-page-list="[5, 10, 15, 20, 30, 50]"
                               data-select-item-name="worker_picker"
                               data-show-export="true"
                               data-click-to-select="true"
                               data-toolbar="#toolbar"
                               data-sort-name="name"
                               data-sort-order="desc">
                            <div class="bars pull-left">
                            </div>
                            <thead>
                            <tr>
                                <th data-field="id"   data-align="left" data-sortable="true"  >账户ID</th>
                                <th data-field="name"  data-align="left" data-sortable="true"  >子账户名</th>
                                <th data-field="display_name"   data-align="left" data-sortable="true" >显示称谓</th>
                                <th data-field="contact"   data-align="left" data-sortable="true" >联系人姓名</th>
                                <th data-field="operate">操作</th>
                            </tr>

                            </thead>
                            <tbody>

                            </tbody>
                        </table>
                    </div>
                </div><!-- /.box -->
            </div><!-- /.col -->
        </div>
    </section>
</div>
<?php include APP_PATH.'../template/public/footer.php'; ?>
<script>
    function ajax_request(params) {
        var parameter_str = jQuery.param( params.data );
        $.get("{:url('admin/Childusers/get_child_users')}?"+parameter_str, function(data){
            // alert(data);
            eval("data="+data);
            // alert(data);
            params.success(data);
        });
    }
    function  reset_pwd(id) {
        $.get("{:url('admin/Manageuser/reset_pwd')}?user_id=" + id, function (res) {
            if (res.code > 0) {
                layer.open({
                    type: 1
                    , offset: 'auto' //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                    , id: 'layerDemoauto' //防止重复弹出
                    , content: '<div style="padding: 20px 100px;">' + res.msg + '</div>'
                    , btn: '关闭'
                    , btnAlign: 'c' //按钮居中
                    , shade: 0 //不显示遮罩
                    , yes: function () {
                        layer.closeAll();
                    }
                });
            } else {
                layer.open({
                    type: 1
                    , offset: 'auto' //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                    , id: 'layerDemoaoto1' //防止重复弹出
                    , content: '<div style="padding: 20px 100px;">' + res.msg + '</div>'
                    , btn: '关闭'
                    , btnAlign: 'c' //按钮居中
                    , shade: 0 //不显示遮罩
                    , yes: function () {
                        layer.closeAll();
                    }
                });
            }
        });
    }
</script>
</html>